package com.wx.controller;

import cn.dev33.satoken.util.SaResult;
import com.wx.dto.ContactsDto;
import com.wx.service.ContactsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api")
public class ContactsController {
    @Autowired
    private ContactsService contactsService;

    @GetMapping("/queryContacts")
    public SaResult queryContactsInfo(){
        return  contactsService.queryContactsInfo();
    }

    @PostMapping("/addContacts")
    public SaResult addContacts(@RequestBody ContactsDto contactsDto){
        return  contactsService.addContacts(contactsDto);
    }

    @PutMapping("/updateContacts{id}")
    public SaResult updateContacts(@RequestBody ContactsDto contactsDto,@PathVariable String id){
        return  contactsService.updateContacts(contactsDto,id);
    }

    @DeleteMapping("/deleteContacts{id}")
    public SaResult deleteContacts(@PathVariable String id) {
        return contactsService.deleteContacts(id);
    }


}
